home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 1995 #5 & #6 / Amiga Plus CD - 1995 - No. 5 and 6.iso / pd / daten / astrolog / src / intrpret.c < prev    next >
C/C++ Source or Header  |  1995-08-11  |  23KB  |  691 lines

  1. /*                                                               -*- C -*-
  2. ** Astrolog (Version 4.40) File: intrpret.c
  3. **
  4. ** IMPORTANT NOTICE: The graphics database and chart display routines
  5. ** used in this program are Copyright (C) 1991-1995 by Walter D. Pullen
  6. ** (astara@u.washington.edu). Permission is granted to freely use and
  7. ** distribute these routines provided one doesn't sell, restrict, or
  8. ** profit from them in any way. Modification is allowed provided these
  9. ** notices remain with any altered or edited versions of the program.
  10. **
  11. ** The main planetary calculation routines used in this program have
  12. ** been Copyrighted and the core of this program is basically a
  13. ** conversion to C of the routines created by James Neely as listed in
  14. ** Michael Erlewine's 'Manual of Computer Programming for Astrologers',
  15. ** available from Matrix Software. The copyright gives us permission to
  16. ** use the routines for personal use but not to sell them or profit from
  17. ** them in any way.
  18. **
  19. ** The PostScript code within the core graphics routines are programmed
  20. ** and Copyright (C) 1992-1993 by Brian D. Willoughby
  21. ** (brianw@sounds.wa.com). Conditions are identical to those above.
  22. **
  23. ** The extended accurate ephemeris databases and formulas are from the
  24. ** calculation routines in the program "Placalc" and are programmed and
  25. ** Copyright (C) 1989,1991,1993 by Astrodienst AG and Alois Treindl
  26. ** (alois@azur.ch). The use of that source code is subject to
  27. ** regulations made by Astrodienst Zurich, and the code is not in the
  28. ** public domain. This copyright notice must not be changed or removed
  29. ** by any user of this program.
  30. **
  31. ** Initial programming 8/28,30, 9/10,13,16,20,23, 10/3,6,7, 11/7,10,21/1991.
  32. ** X Window graphics initially programmed 10/23-29/1991.
  33. ** PostScript graphics initially programmed 11/29-30/1992.
  34. ** Last code change made 1/29/1995.
  35. */
  36.  
  37. /* $VER: $Id: intrpret.c,v 1.2 1995/07/02 22:21:48 tf Exp $ */
  38.  
  39. #include "astrolog.h"
  40.  
  41.  
  42. #ifdef INTERPRET
  43. /*
  44. ******************************************************************************
  45. ** Interpretation Routines.
  46. ******************************************************************************
  47. */
  48.  
  49. /* This function is used by the interpretation routines to print out lines  */
  50. /* of text with newlines inserted just before the end of screen is reached. */
  51.  
  52. void FieldWord(sz)
  53. char *sz;
  54. {
  55.   static char line[cchSzMax];
  56.   static int cursor = 0;
  57.   int i, j;
  58.  
  59.   /* Hack: Dump buffer if function called with a null string. */
  60.  
  61.   if (sz == NULL) {
  62.     line[cursor] = 0;
  63.     PrintSz(line); PrintL();
  64.     cursor = 0;
  65.     return;
  66.   }
  67.   if (cursor)
  68.     line[cursor++] = ' ';
  69.  
  70.   for (i = 0; (line[cursor] = sz[i]); i++, cursor++)
  71.     ;
  72.  
  73.   /* When buffer overflows 'n' columns, display one line and start over. */
  74.  
  75.   while (cursor >= us.nScreenWidth-1) {
  76.     for (i = us.nScreenWidth-1; line[i] != ' '; i--)
  77.       ;
  78.     line[i] = 0;
  79.     PrintSz(line); PrintL();
  80.     line[0] = line[1] = ' ';
  81.     for (j = 2; (line[j] = line[i+j-1]) != 0; j++)
  82.       ;
  83.     cursor -= (i-1);
  84.   }
  85. }
  86.  
  87.  
  88. /* Display a general interpretation of what each sign of the zodiac, house, */
  89. /* and planet or object means. This is called to do the -I0 switch table.   */
  90.  
  91. void InterpretGeneral()
  92. {
  93.   char sz[cchSzDef*2];
  94.   int i;
  95.  
  96.   PrintSz("Signs of the zodiac represent psychological characteristics.\n\n");
  97.   for (i = 1; i <= cSign; i++) {
  98.     AnsiColor(kSignA(i));
  99.     sprintf(sz, "%s is", szSignName[i]); FieldWord(sz);
  100.     sprintf(sz, "%s, and", szDesc[i]); FieldWord(sz);
  101.     sprintf(sz, "%s.", szDesire[i]); FieldWord(sz);
  102.     FieldWord(NULL);
  103.   }
  104.   AnsiColor(kDefault);
  105.   PrintSz("\nHouses represent different areas within one's life.\n\n");
  106.   for (i = 1; i <= cSign; i++) {
  107.     AnsiColor(kSignA(i));
  108.     sprintf(sz, "The %d%s House is the area of life dealing with",
  109.       i, szSuffix[i]); FieldWord(sz);
  110.     sprintf(sz, "%s.", szLifeArea[i]); FieldWord(sz);
  111.     FieldWord(NULL);
  112.   }
  113.   AnsiColor(kDefault);
  114.   PrintSz("\nPlanets represent various parts of one's mind or self.\n\n");
  115.   for (i = 1; i <= cObjInt; i++) {
  116.     if (ignore[i] || FCusp(i))
  117.       continue;
  118.     AnsiColor(kObjA[i]);
  119.     if (i <= oMoo || (FBetween(i, oNod, oCore)) && (i != oLil || fSouthNode))
  120.       FieldWord("The");
  121.     sprintf(sz, "%s%s%s represents one's",
  122.       i == oNod ? "North " : (i == oFor ? "Part of " : ""), szObjName[i],
  123.       i == 13 ? " Athena" : ""); FieldWord(sz);
  124.     sprintf(sz, "%s.", szMindPart[i]); FieldWord(sz);
  125.     FieldWord(NULL);
  126.   }
  127.   AnsiColor(kDefault);
  128. }
  129.  
  130.  
  131. /* Display a general interpretation of what each aspect type means. This */
  132. /* is called when printing the interpretation table in the -I0 switch.   */
  133.  
  134. void InterpretAspectGeneral()
  135. {
  136.   char sz[cchSzDef*2];
  137.   int i;
  138.  
  139.   PrintSz("\nAspects are different relationships between planets.\n\n");
  140.   for (i = 1; i <= Min(us.nAsp, cAspectInt); i++) {
  141.     AnsiColor(kAspA[i]);
  142.     sprintf(sz, "When planets are %s, one", szAspectName[i]);
  143.     FieldWord(sz); sprintf(sz, szInteract[i], ""); FieldWord(sz);
  144.     FieldWord("another.");
  145.     if (szTherefore[i][0]) {
  146.       sprintf(sz, "%s.", szTherefore[i]); FieldWord(sz);
  147.     }
  148.     FieldWord(NULL);
  149.   }
  150.   return;
  151. }
  152.  
  153.  
  154. /* Print the interpretation of each planet in sign and house, as specified */
  155. /* with the -I switch. This is basically array accessing combining the     */
  156. /* meanings of each planet, sign, and house, and a couple of other things. */
  157.  
  158. void InterpretLocation()
  159. {
  160.   char sz[cchSzDef*2], c;
  161.   int i, j;
  162.  
  163.   PrintL();
  164.   for (i = 1; i <= cObjInt; i++) {
  165.     if (ignore[i] || FCusp(i))
  166.       continue;
  167.     AnsiColor(kObjA[i]);
  168.     j = SFromZ(planet[i]); c = Dignify(i, j);
  169.     sprintf(sz, "%s%s%s%s in %s", ret[i] < 0.0 ? "Retrograde " : "",
  170.       i == oNod ? "North " : (i == oFor ? "Part of " : ""), szObjName[i],
  171.       i == 13 ? " Athena" : "", szSignName[j]);
  172.     FieldWord(sz);
  173.     sprintf(sz, "and %d%s House:", inhouse[i], szSuffix[inhouse[i]]);
  174.     FieldWord(sz);
  175.     FieldWord("This person's"); FieldWord(szMindPart[i]); FieldWord("is");
  176.     if (((int)planet[i]) % 30 < 10)
  177.       FieldWord("very");
  178.     sprintf(sz, "%s, and", szDesc[j]); FieldWord(sz);
  179.     sprintf(sz, "%s.", szDesire[j]); FieldWord(sz);
  180.     FieldWord("Most often this manifests");
  181.     if (ret[i] < 0.0 && i != oNod)
  182.       FieldWord("in an independent, backward, introverted manner, and");
  183.     FieldWord("in the area of life dealing with");
  184.     sprintf(sz, "%s.", szLifeArea[inhouse[i]]); FieldWord(sz);
  185.  
  186.     /* Extra information if planet is in its ruling, falling, etc, sign. */
  187.  
  188.     if (c == 'R')
  189.       FieldWord("This is a major aspect of the person's psyche!");
  190.     else if (c == 'F')
  191.       FieldWord("(This bit plays only a minor part in the person's psyche.)");
  192.     else if (c == 'e')
  193.       FieldWord("It is easy for them to express this part of themself.");
  194.     else if (c == 'd')
  195.       FieldWord("It is difficult for them to express this part of themself.");
  196.     FieldWord(NULL);
  197.   }
  198. }
  199.  
  200.  
  201. /* Print an interpretation for a particular aspect in effect in a chart. */
  202. /* This is called from the InterpretGrid and ChartAspect routines.       */
  203.  
  204. void InterpretAspect(x, y)
  205. int x, y;
  206. {
  207.   char sz[cchSzDef*2];
  208.   int n;
  209.  
  210.   n = grid->n[x][y];
  211.   if (n < 1 || n > cAspectInt ||
  212.     FCusp(x) || FCusp(y) || x > cObjInt || y > cObjInt)
  213.     return;
  214.   AnsiColor(kAspA[n]);
  215.   sprintf(sz, "%s %s %s: This person's", szObjName[x],
  216.     szAspectName[n], szObjName[y]);
  217.   FieldWord(sz); FieldWord(szMindPart[x]);
  218.   sprintf(sz, szInteract[n],
  219.     szModify[Min(abs(grid->v[x][y])/150, 2)][n-1]);
  220.   FieldWord(sz);
  221.   sprintf(sz, "their %s.", szMindPart[y]); FieldWord(sz);
  222.   if (szTherefore[n][0]) {
  223.     sprintf(sz, "%s.", szTherefore[n]); FieldWord(sz);
  224.   }
  225.   FieldWord(NULL);
  226. }
  227.  
  228.  
  229. /* Print the interpretation of each aspect in the aspect grid, as specified */
  230. /* with the -g -I switch. Again, this is done by basically array accessing  */
  231. /* of the meanings of the two planets in aspect and of the aspect itself.   */
  232.  
  233. void InterpretGrid()
  234. {
  235.   int i, j;
  236.  
  237.   for (i = 1; i < cObjInt; i++) if (!ignore[i] && !FCusp(i))
  238.     for (j = i+1; j <= cObjInt; j++) if (!ignore[j] && !FCusp(i))
  239.       InterpretAspect(i, j);
  240. }
  241.  
  242.  
  243. /* Print an interpretation for a particular midpoint in effect in a chart. */
  244. /* This is called from the ChartMidpoint routine.                          */
  245.  
  246. void InterpretMidpoint(x, y)
  247. int x, y;
  248. {
  249.   char sz[cchSzDef*2];
  250.   int n, i;
  251.  
  252.   if (FCusp(x) || FCusp(y) || x > cObjInt || y > cObjInt)
  253.     return;
  254.   n = grid->n[y][x];
  255.   AnsiColor(kSignA(n));
  256.   sprintf(sz, "%s midpoint %s in %s: The merging of the person's",
  257.     szObjName[x], szObjName[y], szSignName[n]);
  258.   FieldWord(sz); FieldWord(szMindPart[x]);
  259.   FieldWord("with their"); FieldWord(szMindPart[y]);
  260.   FieldWord("is");
  261.   if (grid->v[y][x]/60 < 10)
  262.     FieldWord("very");
  263.   sprintf(sz, "%s, and", szDesc[n]); FieldWord(sz);
  264.   sprintf(sz, "%s.", szDesire[n]); FieldWord(sz);
  265.   FieldWord("Most often this manifests in");
  266.   if (ret[x]+ret[y] < 0.0 && x != oNod && y != oNod)
  267.     FieldWord("an independent, backward, introverted manner, and");
  268.   FieldWord("the area of life dealing with");
  269.   i = HousePlaceIn(ZFromS(n) + (real)grid->v[y][x]/60.0);
  270.   sprintf(sz, "%s.", szLifeArea[i]); FieldWord(sz);
  271.   FieldWord(NULL);
  272. }
  273.  
  274.  
  275. /* This is a subprocedure of ChartInDay(). Print the interpretation for   */
  276. /* a particular instance of the various exciting events that can happen.  */ 
  277.  
  278. void InterpretInDay(source, aspect, dest)
  279. int source, aspect, dest;
  280. {
  281.   char sz[cchSzDef*2];
  282.  
  283.   if (source > cObjInt || dest > cObjInt)
  284.     return;
  285.  
  286.   /* Interpret object changing direction. */
  287.  
  288.   if (aspect == aDir) {
  289.     AnsiColor(kObjA[source]);
  290.     FieldWord("Energy representing"); FieldWord(szMindPart[source]);
  291.     FieldWord("will tend to manifest in");
  292.     FieldWord(dest ? "an independent, backward, introverted" :
  293.       "the standard, direct, open");
  294.     FieldWord("manner.");
  295.     FieldWord(NULL);
  296.  
  297.   /* Interpret object entering new sign. */
  298.  
  299.   } else if (aspect == aSig) {
  300.     AnsiColor(kObjA[source]);
  301.     FieldWord("Energy representing"); FieldWord(szMindPart[source]);
  302.     sprintf(sz, "will be %s,", szDesc[dest]);
  303.     FieldWord(sz);
  304.     sprintf(sz, "and it %s.", szDesire[dest]); FieldWord(sz);
  305.     FieldWord(NULL);
  306.  
  307.   /* Interpret aspect between transiting planets. */
  308.  
  309.   } else if (aspect > 0 && aspect <= cAspectInt) {
  310.     AnsiColor(kAspA[aspect]);
  311.     FieldWord("Energy representing"); FieldWord(szMindPart[source]);
  312.     sprintf(sz, szInteract[aspect], szModify[1][aspect-1]);
  313.     FieldWord(sz);
  314.     sprintf(sz, "energies of %s.", szMindPart[dest]); FieldWord(sz);
  315.     if (szTherefore[aspect][0]) {
  316.       if (aspect > aCon) {
  317.         sprintf(sz, "%s.", szTherefore[aspect]); FieldWord(sz);
  318.       } else
  319.         FieldWord("They will affect each other prominently.");
  320.     }
  321.     FieldWord(NULL);
  322.   }
  323. }
  324.  
  325.  
  326. /* This is a subprocedure of ChartTransit(). Print the interpretation for */
  327. /* a particular transit of a planet to a natal object of a chart.         */ 
  328.  
  329. void InterpretTransit(source, aspect, dest)
  330. int source, aspect, dest;
  331. {
  332.   char sz[cchSzDef*2];
  333.  
  334.   if (source <= oCore && dest <= oCore && aspect <= cAspectInt) {
  335.     AnsiColor(kAspA[aspect]);
  336.     FieldWord("Energy representing"); FieldWord(szMindPart[source]);
  337.     sprintf(sz, szInteract[aspect], szModify[1][aspect-1]);
  338.     FieldWord(sz);
  339.     if (source != dest) {
  340.       sprintf(sz, "the person's %s.", szMindPart[dest]); FieldWord(sz);
  341.     } else
  342.       FieldWord("the same aspect inside the person's makeup.");
  343.     if (szTherefore[aspect][0]) {
  344.       if (aspect > aCon) {
  345.         sprintf(sz, "%s.", szTherefore[aspect]); FieldWord(sz);
  346.       } else
  347.         FieldWord("This part of their psyche will be strongly influenced.");
  348.     }
  349.     FieldWord(NULL);
  350.   }
  351. }
  352.  
  353.  
  354. /* Print the interpretation of one person's planet in another's sign and    */
  355. /* house, in a synastry chart as specified with the -r switch combined with */
  356. /* -I. This is very similar to the interpretation of the standard -v chart  */
  357. /* in InterpretLocation(), but we treat the chart as a relationship here.   */
  358.  
  359. void InterpretSynastry()
  360. {
  361.   char sz[cchSzDef*2], c;
  362.   int i, j;
  363.  
  364.   PrintL();
  365.   for (i = 1; i <= cObjInt; i++) {
  366.     if (ignore[i] || FCusp(i))
  367.       continue;
  368.     AnsiColor(kObjA[i]);
  369.     j = SFromZ(planet[i]); c = Dignify(i, j);
  370.     sprintf(sz, "%s%s%s%s in %s,", ret[i] < 0.0 ? "Retrograde " : "",
  371.       i == oNod ? "North " : (i == oFor ? "Part of " : ""), szObjName[i],
  372.       i == 13 ? " Athena" : "", szSignName[j]);
  373.     FieldWord(sz);
  374.     sprintf(sz, "in their %d%s House:", inhouse[i], szSuffix[inhouse[i]]);
  375.     FieldWord(sz);
  376.     FieldWord("Person1's"); FieldWord(szMindPart[i]); FieldWord("is");
  377.     if (((int)planet[i]) % 30 < 10)
  378.       FieldWord("very");
  379.     sprintf(sz, "%s, and", szDesc[j]); FieldWord(sz);
  380.     sprintf(sz, "%s.", szDesire[j]); FieldWord(sz);
  381.     FieldWord("This");
  382.     if (ret[i] < 0.0 && i != oNod)
  383.       FieldWord(
  384.         "manifests in an independent, backward, introverted manner, and");
  385.     FieldWord("affects Person2 in the area of life dealing with");
  386.     sprintf(sz, "%s.", szLifeArea[inhouse[i]]); FieldWord(sz);
  387.  
  388.     /* Extra information if planet is in its ruling, falling, etc, sign. */
  389.  
  390.     if (c == 'R')
  391.       FieldWord("This is a major aspect of Person1's psyche!");
  392.     else if (c == 'F')
  393.       FieldWord("(This bit plays only a minor part in Person1's psyche.)");
  394.     else if (c == 'e')
  395.       FieldWord("Person2 is affected harmoniously in this way.");
  396.     else if (c == 'd')
  397.       FieldWord("Person2 is affected discordantly in this way.");
  398.     FieldWord(NULL);
  399.   }
  400. }
  401.  
  402.  
  403. /* Print an interpretation for a particular aspect in effect in a comparison */
  404. /* relationship chart. This is called from the InterpretGridRelation and     */
  405. /* the ChartAspectRelation routines.                                         */
  406.  
  407. void InterpretAspectRelation(x, y)
  408. int x, y;
  409. {
  410.   char sz[cchSzDef*2];
  411.   int n;
  412.  
  413.   n = grid->n[y][x];
  414.  
  415.   if (n < 1 || n > cAspectInt || FCusp(x) || FCusp(y) || x > cObjInt || y > cObjInt)
  416.     return;
  417.  
  418.   AnsiColor(kAspA[n]);
  419.   sprintf(sz, "%s %s %s: Person1's", szObjName[x],
  420.     szAspectName[n], szObjName[y]);
  421.   FieldWord(sz); FieldWord(szMindPart[x]);
  422.   sprintf(sz, szInteract[n],
  423.     szModify[Min(abs(grid->v[y][x])/150, 2)][n-1]);
  424.   FieldWord(sz);
  425.   sprintf(sz, "Person2's %s.", szMindPart[y]); FieldWord(sz);
  426.   if (szTherefore[n][0]) {
  427.     if (n != 1) {
  428.       sprintf(sz, "%s.", szTherefore[n]); FieldWord(sz);
  429.     } else
  430.       FieldWord("These parts affect each other prominently.");
  431.   }
  432.   FieldWord(NULL);
  433. }
  434.  
  435.  
  436. /* Print the interpretation of each aspect in the relationship aspect grid, */
  437. /* as specified with the -r0 -g -I switch combination.                      */
  438.  
  439. void InterpretGridRelation()
  440. {
  441.   int i, j;
  442.  
  443.   for (i = 1; i <= cObjInt; i++) if (!ignore[i])
  444.     for (j = 1; j <= cObjInt; j++) if (!ignore[j])
  445.       InterpretAspectRelation(i, j);
  446. }
  447.  
  448.  
  449. /* Print the interpretation of a midpoint in the relationship grid, as */
  450. /* specified with the -r0 -m -I switch combination.                    */
  451.  
  452. void InterpretMidpointRelation(x, y)
  453. int x, y;
  454. {
  455.   char sz[cchSzDef*2];
  456.   int n;
  457.  
  458.   if (FCusp(x) || FCusp(y) || x > cObjInt || y > cObjInt)
  459.     return;
  460.  
  461.   n = grid->n[y][x];
  462.   AnsiColor(kSignA(n));
  463.  
  464.   sprintf(sz, "%s midpoint %s in %s: The merging of person1's", szObjName[x],
  465.                                                                 szObjName[y],
  466.                                                                 szSignName[n]);
  467.   FieldWord(sz); FieldWord(szMindPart[x]);
  468.   FieldWord("with person2's"); FieldWord(szMindPart[y]);
  469.   FieldWord("is");
  470.  
  471.   if (grid->v[y][x]/60 < 10)
  472.     FieldWord("very");
  473.  
  474.   sprintf(sz, "%s, and", szDesc[n]); FieldWord(sz);
  475.   sprintf(sz, "%s.", szDesire[n]); FieldWord(sz);
  476.  
  477.   if (cp1.dir[x]+cp2.dir[y] < 0.0 && x != oNod && y != oNod) {
  478.     FieldWord("Most often this manifests in");
  479.     FieldWord("an independent, backward, introverted manner.");
  480.   }
  481.   FieldWord(NULL);
  482. }
  483. #endif /* INTERPRET */
  484.  
  485.  
  486. /*
  487. ******************************************************************************
  488. ** Chart Influence Routines.
  489. ******************************************************************************
  490. */
  491.  
  492. /* This is a subprocedure of ChartInfluence(). Based on the values in the */
  493. /* array parameter 'value', store numbers in array 'rank' reflecting the  */
  494. /* relative order, e.g. value[x] 2nd greatest array value -> rank[x] = 2. */
  495.  
  496. void SortRank(value, rank, size)
  497. real *value;
  498. int *rank, size;
  499. {
  500.   int h, i, j, k;
  501.  
  502.   value[0] = -1.0;
  503.  
  504.   for (i = 1; i <= size; i++)
  505.     rank[i] = -1;
  506.  
  507.   for (h = 1, i = 0; h <= size; h++) 
  508.   {
  509.     if (size != cSign && (ignore[h] || !FThing(h)))
  510.       continue;
  511.     i++;
  512.     k = 0;
  513.  
  514.     for (j = 1; j <= size; j++) 
  515.     {
  516.       if (size != cSign && (ignore[j] || !FThing(j)))
  517.         continue;
  518.       if (value[j] > value[k] && rank[j] < 0)
  519.         k = j;
  520.     }
  521.  
  522.     /* 'k' is the current position of the 'i'th place planet. */
  523.  
  524.     rank[k] = i;
  525.   }
  526. }
  527.  
  528.  
  529. /* Print out a list of power values and relative rankings, based on the */
  530. /* placements of the planets, and their aspects in the aspect grid, as  */
  531. /* specified with the -j "find influences" switch.                      */
  532.  
  533. void ChartInfluence()
  534. {
  535.   real power[oNorm+1], power1[oNorm+1], power2[oNorm+1], total, total1, total2, x;
  536.   int rank[oNorm+1], rank1[oNorm+1], rank2[oNorm+1], i, j, k, l;
  537.   char sz[cchSzDef], c;
  538.  
  539.   for (i = 1; i <= oNorm; i++)
  540.     power1[i] = power2[i] = 0.0;
  541.   total = total1 = total2 = 0.0;
  542.  
  543.   /* First, for each object, find its power based on its placement alone. */
  544.  
  545.   for (i = 1; i <= oNorm; i++) if (!ignore[i] && FThing(i)) 
  546.   {
  547.     j = SFromZ(planet[i]);
  548.     power1[i] += objectinf[i];            /* Influence of planet itself. */
  549.     power1[i] += houseinf[inhouse[i]];    /* Influence of house it's in. */
  550.     c = Dignify(i, j);
  551.  
  552.     switch (c) 
  553.     {
  554.       case 'R': x = objectinf[oNorm+1]; break; /* Planets in signs they rule / */
  555.       case 'e': x = objectinf[oNorm+2]; break; /* exalted in have influence.   */
  556.       default:  x = 0.0;
  557.     }
  558.     c = Dignify(i, inhouse[i]);
  559.  
  560.     switch (c) 
  561.     {
  562.       case 'R': x += houseinf[cSign+1]; break; /* Planet in house aligned with */
  563.       case 'e': x += houseinf[cSign+2]; break; /* sign ruled has influence.    */
  564.       default: ;
  565.     }
  566.  
  567.     power1[i] += x;
  568.  
  569.     if (i != rules[j])                       /* The planet ruling the sign */
  570.       power1[rules[j]] += objectinf[i]/2.0;  /* and the house that the     */
  571.  
  572.     if (i != (j = rules[inhouse[i]]))        /* current planet is in, gets */
  573.       power1[j] += objectinf[i]/2.0;         /* extra influence.           */
  574.   }
  575.  
  576.   for (i = 1; i <= cSign; i++) {        /* Various planets get influence */
  577.     j = SFromZ(house[i]);               /* if house cusps fall in signs  */
  578.     power1[rules[j]] += houseinf[i];    /* they rule.                    */
  579.   }
  580.  
  581.   /* Second, for each object, find its power based on aspects it makes. */
  582.  
  583.   if (!FCreateGrid(fFalse))
  584.     return;
  585.  
  586.   for (j = 1; j <= oNorm; j++) if (!ignore[j] && FThing(j))
  587.   {
  588.     for (i = 1; i <= oNorm; i++) if (!ignore[i] && FThing(i) && i != j) 
  589.     {
  590.       k = grid->n[Min(i, j)][Max(i, j)];
  591.       if (k) {
  592.         l = grid->v[Min(i, j)][Max(i, j)];
  593.         power2[j] += aspectinf[k]*objectinf[i]*
  594.           (1.0-RAbs((real)l)/60.0/aspectorb[k]);
  595.       }
  596.     }
  597.   }
  598.  
  599.   /* Calculate total power of each planet. */
  600.  
  601.   for (i = 1; i <= oNorm; i++) if (!ignore[i] && FThing(i)) {
  602.     power[i] = power1[i]+power2[i]; total1 += power1[i]; total2 += power2[i];
  603.   }
  604.   total = total1+total2;
  605.  
  606.   /* Finally, determine ranks of the arrays, then print everything out. */
  607.  
  608.   SortRank(power1, rank1, oNorm); SortRank(power2, rank2, oNorm);
  609.   SortRank(power, rank, oNorm);
  610.   PrintSz("  Planet:    Position      Aspects    Total Rank  Percent\n");
  611.   for (i = 1; i <= oNorm; i++) if (!ignore[i] && FThing(i)) {
  612.     AnsiColor(kObjA[i]);
  613.     sprintf(sz, "%8.8s: ", szObjName[i]); PrintSz(sz);
  614.     sprintf(sz, "%6.1f (%2d) +%6.1f (%2d) =%7.1f (%2d) /%6.1f%%\n",
  615.       power1[i], rank1[i], power2[i], rank2[i],
  616.       power[i], rank[i], power[i]/total*100.0); PrintSz(sz);
  617.   }
  618.   AnsiColor(kDefault);
  619.   sprintf(sz, "   Total: %6.1f      +%6.1f      =%7.1f      / 100.0%%\n",
  620.     total1, total2, total); PrintSz(sz);
  621.  
  622.   /* Now, print out a list of power values and relative rankings, based on  */
  623.   /* the power of each sign of the zodiac, as indicated by the placement of */
  624.   /* the planets above, in the chart, as specified with the -j0 switch.     */
  625.  
  626.   if (!us.fInfluenceSign)
  627.     return;
  628.  
  629.   for (i = 1; i <= cSign; i++)
  630.     power1[i] = 0.0;
  631.  
  632.   /* For each sign, determine its power based on the power of the object. */
  633.  
  634.   for (i = 1; i <= oNorm; i++) if (!ignore[i] && FThing(i)) {
  635.     power1[SFromZ(planet[i])] += power[i] / 2.0;
  636.     power1[inhouse[i]]        += power[i] / 4.0;
  637.     power1[ruler1[i]]         += power[i] / 3.0;
  638.     if (ruler2[i])
  639.       power1[ruler2[i]]       += power[i] / 4.0;
  640.   }
  641.   if (!fSouthNode && !ignore[oNod]) {
  642.     power1[Mod12(SFromZ(planet[oNod])+6)] += power[oNod] / 2.0;  /* South */
  643.     power1[Mod12(inhouse[oNod]+6)]        += power[oNod] / 4.0;  /* Node. */
  644.   }
  645.  
  646.   for (i = cThing+1; i <= oCore; i++) if (!ignore[i]) {
  647.     power1[SFromZ(planet[i])] += objectinf[i];
  648.   }
  649.  
  650.   total1 = 0.0;
  651.   for (i = 1; i <= cSign; i++)
  652.     total1 += power1[i];
  653.   for (i = 1; i <= cSign; i++)
  654.     power1[i] *= total/total1;
  655.   total1 = total;
  656.  
  657.   /* Again, determine ranks in the array, and print everything out. */
  658.  
  659.   SortRank(power1, rank1, cSign);
  660.   PrintSz(
  661.     "\n       Sign:  Power Rank  Percent  -   Element  Power  Percent\n");
  662.   for (i = 1; i <= cSign; i++) {
  663.     AnsiColor(kSignA(i));
  664.     sprintf(sz, "%11.11s: ", szSignName[i]); PrintSz(sz);
  665.     sprintf(sz, "%6.1f (%2d) /%6.1f%%",
  666.       power1[i], rank1[i], power1[i]/total1*100.0); PrintSz(sz);
  667.     if (i <= 4) {
  668.       sprintf(sz, "  -%9.7s:", szElem[i-1]); PrintSz(sz);
  669.       total2 = 0.0;
  670.       for (j = 1; j < cSign; j += 4)
  671.         total2 += power1[i-1+j];
  672.       sprintf(sz, "%7.1f /%6.1f%%", total2, total2/total1*100.0); PrintSz(sz);
  673.     } else if (i == 6) {
  674.       AnsiColor(kDefault);
  675.       PrintSz("  -      Mode  Power  Percent");
  676.     } else if (i >= 7 && i <= 9) {
  677.       AnsiColor(kModeA(i-7));
  678.       sprintf(sz, "  -%9.8s:", szMode[i-7]); PrintSz(sz);
  679.       total2 = 0.0;
  680.       for (j = 1; j < cSign; j += 3)
  681.         total2 += power1[i-7+j];
  682.       sprintf(sz, "%7.1f /%6.1f%%", total2, total2/total1*100.0); PrintSz(sz);
  683.     }
  684.     PrintL();
  685.   }
  686.   AnsiColor(kDefault);
  687.   sprintf(sz, "      Total:%7.1f      / 100.0%%\n", total1); PrintSz(sz);
  688. }
  689.  
  690. /* intrpret.c */
  691.